package cn.com.nes.site.entity.iot;

import cn.com.nes.site.listener.*;
import com.alibaba.excel.annotation.ExcelProperty;

import java.math.BigDecimal;

public class RegisterDataItemExcel {
    // 寄存器地址
    @ExcelProperty("寄存器地址")
    private Integer registerAddress;
    @ExcelProperty("位地址")
    private String bitAddress;
//    private Integer bitAddress;
    // 位地址，0-15


    // 数据名称
    @ExcelProperty("数据项名称")
    private String dataName;
    // 数据单位
    @ExcelProperty(value = "数据项单位", converter = DataUnitConvert.class)
    private String dataUnit;
    // 寄存器类型
    @ExcelProperty(value = "寄存器类型", converter = RegisterTypeConverter.class)
    private String registerType;

    @ExcelProperty(value = "读写权限", converter = ReadWriteConverter.class)
    private Integer readWriteType;

    // 数据类型
    @ExcelProperty(value = "数据类型", converter = DataTypeConverter.class)
    private String dataType;
    // 分组
    @ExcelProperty("分组")
    private String classify;
    // 故障检测
    @ExcelProperty(value = "故障检测", converter = ShiFouConverter.class)
    private Integer faultDetection;
    // 故障正常值
    @ExcelProperty("故障正常值")
    private String faultNormalValue;
    // 上限
    @ExcelProperty(value = "上限", converter = BigDecimalConverter.class)
    private BigDecimal upperLimit;
    // 下限
    @ExcelProperty(value = "下限", converter = BigDecimalConverter.class)
    private BigDecimal lowerLimit;
    // 公式
    @ExcelProperty("公式")
    private String formula;
    // 控制公式
    @ExcelProperty("控制公式")
    private String controlFormula;
    // 数据枚举
    @ExcelProperty("数据枚举")
    private String dataEnum;
    // 控制参数枚举
    @ExcelProperty("控制参数枚举")
    private String controlParamEnum;

    @ExcelProperty("指令截断")
    private Integer commandCut;

    @ExcelProperty("显示上限")
    private BigDecimal showRangeUp;

    @ExcelProperty("显示下限")
    private BigDecimal showRangeLow;

    @ExcelProperty("异常值")
    private String errorValue;

    @ExcelProperty("异常值的替换值")
    private String errorReplaceValue;

    public String getErrorValue() {
        return errorValue;
    }

    public void setErrorValue(String errorValue) {
        this.errorValue = errorValue;
    }

    public String getErrorReplaceValue() {
        return errorReplaceValue;
    }

    public void setErrorReplaceValue(String errorReplaceValue) {
        this.errorReplaceValue = errorReplaceValue;
    }

    public BigDecimal getShowRangeUp() {
        return showRangeUp;
    }

    public void setShowRangeUp(BigDecimal showRangeUp) {
        this.showRangeUp = showRangeUp;
    }

    public BigDecimal getShowRangeLow() {
        return showRangeLow;
    }

    public void setShowRangeLow(BigDecimal showRangeLow) {
        this.showRangeLow = showRangeLow;
    }

    public Integer getCommandCut() {
        return commandCut;
    }

    public void setCommandCut(Integer commandCut) {
        this.commandCut = commandCut;
    }

    public Integer getRegisterAddress() {
        return registerAddress;
    }

    public void setRegisterAddress(Integer registerAddress) {
        this.registerAddress = registerAddress;
    }

    public String getDataName() {
        return dataName;
    }

    public void setDataName(String dataName) {
        this.dataName = dataName;
    }

    public String getDataUnit() {
        return dataUnit;
    }

    public void setDataUnit(String dataUnit) {
        this.dataUnit = dataUnit;
    }

    public String getRegisterType() {
        return registerType;
    }

    public void setRegisterType(String registerType) {
        this.registerType = registerType;
    }

    public Integer getReadWriteType() {
        return readWriteType;
    }

    public void setReadWriteType(Integer readWriteType) {
        this.readWriteType = readWriteType;
    }

    public void setExcelReadWriteType(boolean readable,boolean writable)
    {
        if(readable){
            if(writable){
                this.readWriteType = 0;
            }else{
                this.readWriteType = 1;
            }
        }else{
            if(writable){
                this.readWriteType = 2;
            }else{
                this.readWriteType = 1;
            }
        }
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public Integer getFaultDetection() {
        return faultDetection;
    }

    public void setFaultDetection(Integer faultDetection) {
        this.faultDetection = faultDetection;
    }

    public String getFaultNormalValue() {
        return faultNormalValue;
    }

    public void setFaultNormalValue(String faultNormalValue) {
        this.faultNormalValue = faultNormalValue;
    }

    public BigDecimal getUpperLimit() {
        return upperLimit;
    }

    public void setUpperLimit(BigDecimal upperLimit) {
        this.upperLimit = upperLimit;
    }

    public BigDecimal getLowerLimit() {
        return lowerLimit;
    }

    public void setLowerLimit(BigDecimal lowerLimit) {
        this.lowerLimit = lowerLimit;
    }

    public String getFormula() {
        return formula;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }

    public String getControlFormula() {
        return controlFormula;
    }

    public void setControlFormula(String controlFormula) {
        this.controlFormula = controlFormula;
    }

    public String getDataEnum() {
        return dataEnum;
    }

    public void setDataEnum(String dataEnum) {
        this.dataEnum = dataEnum;
    }

    public String getControlParamEnum() {
        return controlParamEnum;
    }

    public void setControlParamEnum(String controlParamEnum) {
        this.controlParamEnum = controlParamEnum;
    }

//    public Integer getBitAddress() {
//        return bitAddress;
//    }
//
//    public void setBitAddress(Integer bitAddress) {
//        this.bitAddress = bitAddress;
//    }


    public String getBitAddress() {
        return bitAddress;
    }

    public void setBitAddress(String bitAddress) {
        this.bitAddress = bitAddress;
    }

    public String getClassify() {
        return classify;
    }

    public void setClassify(String classify) {
        this.classify = classify;
    }
}
